home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / MATHS / PLPLOT / PLPLOT.ZIP / examples / C / x02c.c < prev    next >
C/C++ Source or Header  |  1994-06-30  |  2KB  |  72 lines

  1. /* $Id: x02c.c,v 1.7 1994/06/30 17:57:12 mjl Exp $
  2.  * $Log: x02c.c,v $
  3.  * Revision 1.7  1994/06/30  17:57:12  mjl
  4.  * All C example programs: made another pass to eliminate warnings when using
  5.  * gcc -Wall.  Lots of cleaning up: got rid of includes of math.h or string.h
  6.  * (now included by plplot.h), eliminated redundant casts, put in more
  7.  * uniform comments, and other minor changes.
  8.  *
  9.  * Revision 1.6  1994/03/30  07:21:45  mjl
  10.  * Changes to all C example programs: special handling for malloc re: header
  11.  * files eliminated, include of stdio.h and stdlib.h eliminated (now done
  12.  * by plplot.h), include of "plplot.h" changed to <plplot.h> to enable
  13.  * simpler builds by the general user, some cleaning up also.
  14. */
  15.  
  16. /*    x02c.c
  17.  
  18.     Multiple window and color map 0 demo.
  19. */
  20.  
  21. #include <plplot.h>
  22.  
  23. /*----------------------------------------------------------------------*\
  24.  * main
  25.  *
  26.  * Demonstrates multiple windows and default color map 0 palette.
  27. \*----------------------------------------------------------------------*/
  28.  
  29. int
  30. main(int argc, char *argv[])
  31. {
  32.     int i, j;
  33.     PLFLT vmin, vmax;
  34.     char text[3];
  35.  
  36. /* Divide screen into 16 regions */
  37.  
  38.     plssub(4, 4);
  39.  
  40. /* Parse and process command line arguments */
  41.  
  42.     (void) plParseInternalOpts(&argc, argv, PL_PARSE_FULL);
  43.  
  44. /* Initialize plplot */
  45.  
  46.     plinit();
  47.  
  48.     plschr(0.0, 3.5);
  49.     plfont(4);
  50.  
  51.     for (i = 0; i <= 15; i++) {
  52.     plcol(i);
  53.     sprintf(text, "%d", i);
  54.     pladv(0);
  55.     vmin = 0.1;
  56.     vmax = 0.9;
  57.     for (j = 0; j <= 2; j++) {
  58.         plwid(j + 1);
  59.         plvpor(vmin, vmax, vmin, vmax);
  60.         plwind(0.0, 1.0, 0.0, 1.0);
  61.         plbox("bc", 0.0, 0, "bc", 0.0, 0);
  62.         vmin = vmin + 0.1;
  63.         vmax = vmax - 0.1;
  64.     }
  65.     plwid(1);
  66.     plptex(0.5, 0.5, 1.0, 0.0, 0.5, text);
  67.     }
  68.  
  69.     plend();
  70.     exit(0);
  71. }
  72.